
Version:=2.2.4
ModuleName:=httpd

Objcet:=apache2.tgz
ObjectDir:=$(ModuleName)-$(Version)
ObjcetSource:=$(ModuleName)-$(Version).tar.gz

DependFiles:=apr apr-util
InstaLibDir:=usr/local/lib

DefaultInstallDir:=usr/local/apache2
ManDir:=/tmp

Config:=--mandir=$(ManDir) \
	CFLAGS=-DBIG_SECURITY_HOLE --enable-so --enable-ssl=static --with-ssl=/usr/local/ssl \
	--enable-cgi --enable-static-support --disable-log-config \
	--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util \
	--enable-static-htpasswd --enable-static-htdigest --with-mpm=worker \
	--disable-status --disable-autoindex \
	--disable-asis --disable-negotiation \
	--disable-imap --disable-actions --disable-userdir

.PHONY: all clean dist_clean

all:$(Objcet)

$(Objcet):$(ObjcetSource) httpd.conf info.php
	tar -xzf $(ObjcetSource)
	cd $(ObjectDir);./configure $(Config)
	$(MAKE) -C $(ObjectDir) clean
	$(MAKE) -C $(ObjectDir)
	$(MAKE) -C $(ObjectDir) install # Install to system for php config.
	$(MAKE) -C $(ObjectDir) install DESTDIR=`pwd`/
	mkdir -p $(InstaLibDir)
	cp -af /usr/local/apr/lib/libapr-1.so* /usr/local/apr-util/lib/libaprutil-1.so* $(InstaLibDir)
	cp -af /usr/local/apr-util/lib/libexpat.so* $(InstaLibDir)
	rm -rf $(DefaultInstallDir)/icons/*
	rm -rf $(DefaultInstallDir)/manual/*
	cd  $(DefaultInstallDir)/bin;\
	rm -rf ab apachectl checkgid dbmmanage envvars envvars-std htcacheclean \
	htdbm httxt2dbm logresolve rotatelogs
	cp -rf httpd.conf server.key server.crt usr/local/apache2/conf
	cp -rf httpd-ssl.conf usr/local/apache2/conf/extra
	cp -rf info.php usr/local/apache2/htdocs
	$(g_STRIP)
	tar -czf $(Objcet) usr 
apr:
	cd $(ObjectDir)/srclib/apr;./configure --prefix=/usr/local/apr; \
	make;make install;

apr-util:
	cd $(ObjectDir)/srclib/apr-util; ./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr; \
	make ;make install;

clean:
	rm -rf $(Objcet) usr

dist_clean:clean
	rm -rf $(ObjectDir) $(ObjcetSource) tmp
	
include ../../Makefile.Res
